package com.thinkgem.jeesite.tools;

import org.apache.commons.io.FileUtils;
import org.apache.commons.io.filefilter.DirectoryFileFilter;
import org.apache.commons.io.filefilter.FileFilterUtils;
import org.junit.Test;

import java.io.File;
import java.util.Collection;

/**
 * Created by Havel on 2019/4/23/023.
 */
public class TEST {

    String url1 = "G:\\ouyang phone\\all\\all\\"; // 源文件夹
    String url2 = "G:\\ouyang phone\\all\\all\\"; // 目标文件夹

    public static void main(String[] args) {

    }

    @Test
    public void test_1(){
        //列出某类文件
        Collection<File> listFiles = FileUtils.listFiles(new File(url1), FileFilterUtils.suffixFileFilter("jpg"), DirectoryFileFilter.INSTANCE);
        showFiles(listFiles);
    }
    private void showFiles(Collection<File> listFiles) {
        if (listFiles==null) {
            return;
        }
        for (File file : listFiles) {
            System.out.println(file.getName());
        }
    }
}
